package com.util;

import org.springframework.util.StringUtils;

import com.mangocity.common.Parameters;


public final class CommonUtils {

    public static String city2code(String city) {
        if (StringUtils.hasText(city)) {
            String code = Parameters.getInstance().getCityCodes().get(city);
            if (StringUtils.hasText(code)) {
                return code;
            }
        } 
        return city;
    }
    
    public static String code2city(String code) {
        if (StringUtils.hasText(code)) {
            String city = Parameters.getInstance().getCodeCities().get(code);
            if (StringUtils.hasText(city)) {
                return city;
            }
        } 
        return code;
    }
    
}
